import flash.events.Event;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Matrix;
#if flash
import flash.net.SharedObject;
#end
import flash.text.TextField;
import flash.text.TextFormat;

class SaveData {
public var currentLevel : Int;
public var damageTaken : Int;
public var difficultly : Int;
public var pausePosition:Float;
#if flash
public var savedData:SharedObject;
#end
  public function new()
  {
    currentLevel = 1;
    pausePosition = 0;
    damageTaken = 0;
    difficultly = 2;
  }
  public function Load()
  {
#if flash
    savedData = SharedObject.getLocal("LevelData");
    if(savedData.data.Level != null)
    {
      currentLevel = savedData.data.Level;
      pausePosition = savedData.data.SoundPosition;
      damageTaken = savedData.data.damageTaken;
      difficultly = savedData.data.difficultly;
    }
#end
  }
  public function Init()
  {
    currentLevel = 1;
    pausePosition = 0;
    damageTaken = 0;
    difficultly = 2;
  }
  public function Reset()
  {
    Init();
    Save();
  }
  public function Save()
  {
#if flash
      savedData.data.Level = currentLevel;
      savedData.data.SoundPosition = pausePosition;
      savedData.data.damageTaken = damageTaken;
      savedData.data.difficultly = difficultly;
      savedData.flush();
#end
  }
 }

